//first declare globals
var SEMF = {};

SEMF["page"] = {};
SEMF["sys"] = {};

// Handling the onClick of Button274 
SEMF.Button274_onClick = function()
{
SEMF.page._date1 = SEMF.funct.set_year(SEMF.page._date1, SEMF.page._year1);
SEMF.page._date1 = SEMF.funct.set_month(SEMF.page._date1, SEMF.page._month1);
SEMF.page._date1 = SEMF.funct.set_day(SEMF.page._date1, SEMF.page._day1);
SEMF.page._date2 = SEMF.funct.set_year(SEMF.page._date2, SEMF.page._year2);
SEMF.page._date2 = SEMF.funct.set_month(SEMF.page._date2, SEMF.page._month2);
SEMF.page._date2 = SEMF.funct.set_day(SEMF.page._date2, SEMF.page._day2);
if(SEMF.funct.compare_dates(SEMF.page._date1, SEMF.page._date2) >  0 )
{
SEMF.page._label1 = SEMF.page._label2 = "Date1 is greater than Date2";

}
else if(SEMF.funct.compare_dates(SEMF.page._date1, SEMF.page._date2) <  0 )
{
SEMF.page._label1 = SEMF.page._label2 = "Date1 is Lesser than Date2";

}
else {
SEMF.page._label1 = SEMF.page._label2 = "Date1 is Equal to Date2";

}
SEMF.page._x = SEMF.page._x +  1 ;

 SEMF.doUpdatePage();
} // end of the function Button274_onClick

// Handling the onClick of Button82 
SEMF.Button82_onClick = function()
{
SEMF.page._year1 = SEMF.page._year2 -  1 ;

 SEMF.doUpdatePage();
} // end of the function Button82_onClick

// Handling the onClick of Button84 
SEMF.Button84_onClick = function()
{
SEMF.page._day1 = SEMF.page._day2;
SEMF.page._month1 = SEMF.page._month2;
SEMF.page._year1 = SEMF.page._year2;

 SEMF.doUpdatePage();
} // end of the function Button84_onClick

// Handling the onClick of Button86 
SEMF.Button86_onClick = function()
{
SEMF.page._year1 = SEMF.page._year2 +  1 ;

 SEMF.doUpdatePage();
} // end of the function Button86_onClick

// Handling the common page onLoad function 
SEMF.onLoad = function()
{

} // end of the function page onLoad

// Handling the onClick of Button276 (just for server request)
SEMF.Button276_onClick = function()
{
var varInOuts = ["pg_date1", SEMF.page._date1,
"pg_year1", SEMF.page._year1,
"pg_month1", SEMF.page._month1,
"pg_day1", SEMF.page._day1,
"pg_date2", SEMF.page._date2,
"pg_year2", SEMF.page._year2,
"pg_month2", SEMF.page._month2,
"pg_day2", SEMF.page._day2,
"pg_label1", SEMF.page._label1,
"pg_label2", SEMF.page._label2,
"pg_x", SEMF.page._x];
var tableInOuts = ["dt_player", SEMF.listIdsFor("player")];
var inherited = [];
if(arguments.length == 2 && arguments[0] == "params")
{
 inherited = arguments[1];
}
var functName = ["funct_name", "Button276_onClick"];
var paramArray = varInOuts.concat(tableInOuts, inherited, functName);
SEMF.request(SEMF.dataModelFileName,
{
  success: SEMF.handleSuccess,
  failure: SEMF.handleFailure,
  argument: {
	  ps: SEMF.onFinishDataUpdate
  },
  timeout: 5000,
  params: paramArray
});

} // end of the function Button276_onClick

